package com.example.spring;

import com.example.entity.Cat;
import com.example.entity.Pig;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringDemo05 {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Pig pig = context.getBean("pig", Pig.class);
        pig.eat();
        System.out.println("----");

        Cat cat = context.getBean("cat1", Cat.class);
        cat.eat();
        System.out.println(cat);
    }
}
